# -*- mode: sh; -*-
BUILD_VERSION="001"

OPENSSL_VERSION="${OPENSSL_VERSION:-1.1.1k}"
PKCS11_HELPER_VERSION="${PKCS11_HELPER_VERSION:-1.28.0}"
LZO_VERSION="${LZO_VERSION:-2.10}"
LZ4_VERSION="${LZ4_VERSION:-1.9.3}"
TAP_WINDOWS_VERSION="${TAP_WINDOWS_VERSION:-9.24.6}"
OPENVPN_VERSION="${OPENVPN_VERSION:-2.5.4}"
OPENVPN_GUI_VERSION="${OPENVPN_GUI_VERSION:-11}"

OPENSSL_URL="${OPENSSL_URL:-https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz}"
PKCS11_HELPER_URL="${PKCS11_HELPER_URL:-https://github.com/OpenSC/pkcs11-helper/releases/download/pkcs11-helper-${PKCS11_HELPER_VERSION}/pkcs11-helper-${PKCS11_HELPER_VERSION}.tar.gz}"
TAP_WINDOWS_URL="${TAP_WINDOWS_URL:-http://build.openvpn.net/downloads/releases/tap-windows-${TAP_WINDOWS_VERSION}.zip}"
LZO_URL="${LZO_URL:-http://www.oberhumer.com/opensource/lzo/download/lzo-${LZO_VERSION}.tar.gz}"
LZ4_URL="${LZ4_URL:-https://github.com/lz4/lz4/archive/refs/tags/v${LZ4_VERSION}.tar.gz}"
OPENVPN_URL="${OPENVPN_URL:-http://build.openvpn.net/downloads/releases/openvpn-${OPENVPN_VERSION}.tar.gz}"
OPENVPN_GUI_URL="${OPENVPN_GUI_URL:-http://build.openvpn.net/downloads/releases/openvpn-gui-${OPENVPN_GUI_VERSION}.tar.gz}"

#CHOST
#CTARGET
#CBUILD
#IMAGEROOT
#BUILDROOT
#SOURCESROOT

WGET="${WGET:-wget}"
CURL="${CURL:-curl}"
MAKE="${MAKE:-make}"

#WGET_OPTS
CURL_OPTS="${CURL_OPTS:---progress-bar --verbose --remote-name -L}"
MAKEOPTS="${MAKEOPTS:--j3}"
#DO_NO_STRIP
#DO_STATIC=
if [ -n "${DO_REALLY_STATIC}" ]; then
	DO_STATIC=1
	export LDFLAGS="-Xcompiler -static"
fi

EXTRA_OPENSSL_CONFIG="${EXTRA_OPENSSL_CONFIG:--static-libgcc}" # uncomment if openvpn.exe fails to start with missing libgcc_s_sjlj-1.dll (win32)
#EXTRA_LZO_CONFIG
#EXTRA_PKCS11_HELPER_CONFIG
#EXTRA_OPENVPN_CONFIG

case "${CHOST}" in
     *mingw*) EXTRA_TARGET_CFLAGS="-Wl,--dynamicbase,--nxcompat -O3";;
esac

# You can enable --high-entropy-va for 64-bit builds if you have recent enough
# mingw-w64
#EXTRA_TARGET_CFLAGS="-Wl,--dynamicbase,--nxcompat,--high-entropy-va"

TARGET_ROOT="${TARGET_ROOT:-/}"
